---
title: Executing Tools
image: "https://og.composio.dev/api/og?title=Executing%20Tools"   # image for socials
keywords: ''
subtitle: "Learn how to execute Composio's tools with different providers and frameworks"
hide-nav-links: false
---

LLMs on their own can only do generation. Tool calling changes that by letting them interact with external services. Instead of just drafting an email, the model can call `GMAIL_SEND_EMAIL` to actually send it. The tool's results feed back to the LLM, closing the loop so it can decide, _act,_ observe, and adapt.

In Composio, every **tool** is a single API action—fully described with schema, parameters, and return type. Tools live inside **toolkits** like _Gmail, Slack, or GitHub_, and Composio handles authentication and user scoping.

<Tip icon="info">
  **User Scoping**: All tools are scoped to a specific user - that's why every example includes a
  `user_id`. Learn how to structure User IDs in [User Management](./user-management). Each user must authenticate with their respective services (Gmail, Calendar, etc.) - see [Authentication](./authenticating-tools)
</Tip>

## Using Chat Completions

Use the Composio SDK with providers like OpenAI, Anthropic, and Google AI. To learn how to set-up these providers, see [Providers](/providers/openai).

<CodeGroup>
  <SnippetCode
    src="fern/snippets/tool-calling/python/exec-tool-completions.py"
    title="Python (OpenAI)"
    highlightStart={32}
    highlightEnd={33}
  />
  <SnippetCode
    src="fern/snippets/tool-calling/typescript/exec-tool-completions.ts"
    title="TypeScript (Anthropic)"
    highlightStart={37}
    highlightEnd={38}
  />
</CodeGroup>

## Using Agentic Frameworks

Agentic frameworks automatically handle the tool execution loop.
Composio provides support for frameworks like this by making sure the tools are formatted into the correct objects for the agentic framework to execute.

<CodeGroup>
  <SnippetCode
    src="fern/snippets/tool-calling/python/exec-tool-agentic.py"
    title="Python (OpenAI Agents SDK)"
    highlightStart={19}
    highlightEnd={23}
  />
  <SnippetCode
    src="fern/snippets/tool-calling/typescript/exec-tool-agentic.ts"
    title="TypeScript (Vercel AI SDK)"
    highlightStart={22}
    highlightEnd={31}
  />
</CodeGroup>

## Direct Tool execution

In case you just want to call a tool without using any framework or LLM provider, you can use the `execute` method directly.

<Tip icon="lightbulb">
  **Finding tool parameters and types:** 
  
  **Platform UI**: [Auth Configs](https://platform.composio.dev?next_page=/auth-configs) → Select your toolkit → Tools & Triggers → Select the tool to see its required and optional parameters
  
  **CLI**: For python and typescript projects, run `composio generate` to generate types. [Learn more →](/docs/cli#generate-type-definitions)
</Tip>

<CodeGroup>
  <SnippetCode
    src="fern/snippets/tool-calling/python/direct-tool-call.py"
    title="Python"
  />
  <SnippetCode
    src="fern/snippets/tool-calling/typescript/direct-tool-call.ts"
    title="TypeScript"
  />
</CodeGroup>

<Note>
The examples above configure toolkit versions at SDK initialization. You can also pass versions per-execution or use environment variables. See [toolkit versioning](/docs/toolkit-versioning) for all configuration options.
</Note>

### Proxy Execute -- Manually calling toolkit APIs

You can proxy requests to any supported toolkit API and let Composio inject the **authentication state**. This is useful when you need an API endpoint that isn't available as a predefined tool.

The `endpoint` can be a relative path or absolute URL. Composio uses the `connected_account_id` to determine the toolkit and resolve relative paths against the appropriate base URL.

<CodeGroup>
  <SnippetCode
    src="fern/snippets/tool-calling/python/proxy-tool.py"
    title="Python"
    startLine={5}
    highlightStart={9}
    highlightEnd={9}
  />
  <SnippetCode
    src="fern/snippets/tool-calling/typescript/proxy-tool.ts"
    title="TypeScript"
    startLine={5}
    highlightStart={9}
    highlightEnd={9}
/>

</CodeGroup>

<Tip icon="info">
  Need an API that isn't supported by any Composio toolkit, or want to extend an existing one? Learn
  how to [create custom tools](/docs/custom-tools).
</Tip>

## Automatic File Handling

Composio handles file operations automatically. Pass file paths to tools that need them, and get local file paths back from tools that return files.

### File Upload

Pass local file paths, URLs, or File objects to tools that accept files:

<CodeGroup>
  <SnippetCode
    src="fern/snippets/tool-calling/python/file-upload.py"
    title="Python"
    startLine={7}
  />
  <SnippetCode
    src="fern/snippets/tool-calling/typescript/file-upload.ts"
    title="TypeScript"
    startLine={8}
  />
</CodeGroup>

### File Download

When tools return files, Composio downloads them to the local directory and provides file path in the response:
When tools return files, Composio downloads them to the local directory and provides the file path in the response:

<CodeGroup>
  <SnippetCode
    src="fern/snippets/tool-calling/python/file-download.py"
    title="Python"
    startLine={4}
  />
  <SnippetCode
    src="fern/snippets/tool-calling/typescript/file-download.ts"
    title="TypeScript"
    startLine={4}
  />

</CodeGroup>

### Disabling Auto File Handling

You can disable automatic file handling when initializing the TypeScript SDK. When disabled, handle file uploads and downloads manually using `files.upload` and `files.download`:

<CodeGroup>
```typescript TypeScript maxLines=60 wordWrap
const composio = new Composio({
  apiKey: process.env.COMPOSIO_API_KEY,
  autoUploadDownloadFiles: false
});

// Now you need to handle files manually using composio.files API
const fileData = await composio.files.upload({
filePath: path.join(\_\_dirname, 'document.pdf'),
toolSlug: 'GOOGLEDRIVE_UPLOAD_FILE',
toolkitSlug: 'googledrive'
});

```
</CodeGroup>

```
